/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class TagLookup
    {
    
        private  List<TagLookupRequest> requestField;


        /// <summary>
        /// Gets and sets the Request property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Request")]
        public List<TagLookupRequest> Request
        {
            get
            {
                if (this.requestField == null)
                {
                    this.requestField = new List<TagLookupRequest>();
                }
                return this.requestField;
            }
            set { this.requestField =  value; }
        }



        /// <summary>
        /// Sets the Request property
        /// </summary>
        /// <param name="list">Request property</param>
        /// <returns>this instance</returns>
        public TagLookup WithRequest(params TagLookupRequest[] list)
        {
            foreach (TagLookupRequest item in list)
            {
                Request.Add(item);
            }
            return this;
        }          
 


        /// <summary>
        /// Checks if Request property is set
        /// </summary>
        /// <returns>true if Request property is set</returns>
        public Boolean IsSetRequest()
        {
            return (Request.Count > 0);
        }





        /// <summary>
        /// Representation of operation that returns
        /// Dictionary of AWS Query Parameters
        /// </summary>
        public IDictionary<String, String> ToDictionary()
        {
            IDictionary<String, String> parameters = new Dictionary<String, String>();
            parameters.Add("Operation", "TagLookup");
            List<TagLookupRequest> requestList = Request;
            foreach (TagLookupRequest request in requestList) 
            {
                List<String> tagNameList  =  request.TagName;
                foreach  (String tagName in tagNameList)
                { 
                    parameters.Add("TagLookup" + "."  + (requestList.IndexOf(request) + 1) + "." + "TagName" + "."  + (tagNameList.IndexOf(tagName) + 1), tagName);
                }	
                if (request.IsSetCustomerId()) 
                {
                    parameters.Add("TagLookup" + "."  + (requestList.IndexOf(request) + 1) + "." + "CustomerId", request.CustomerId);
                }
                if (request.IsSetTagPage()) 
                {
                    parameters.Add("TagLookup" + "."  + (requestList.IndexOf(request) + 1) + "." + "TagPage", request.TagPage + "");
                }
                if (request.IsSetCount()) 
                {
                    parameters.Add("TagLookup" + "."  + (requestList.IndexOf(request) + 1) + "." + "Count", request.Count + "");
                }
                if (request.IsSetTagSort()) 
                {
                    parameters.Add("TagLookup" + "."  + (requestList.IndexOf(request) + 1) + "." + "TagSort", request.TagSort);
                }
                List<String> responseGroupList  =  request.ResponseGroup;
                foreach  (String responseGroup in responseGroupList)
                { 
                    parameters.Add("TagLookup" + "."  + (requestList.IndexOf(request) + 1) + "." + "ResponseGroup" + "."  + (responseGroupList.IndexOf(responseGroup) + 1), responseGroup.ToString());
                }	

            }
            return parameters;
        }


    }

}